//
//  SpellSubviewController.h
//  Quest CoreData
//
//  Created by Matthew Hutton on 11/02/2007.
//  Copyright 2007 Matthew Hutton. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface SpellSubviewController:NSObject{
	//spells per day screen.
	IBOutlet NSBox *spellsPerDayBox;
	IBOutlet NSTextField *domainSpells;
	IBOutlet NSTextField *noOfDomainSpells;
	IBOutlet NSTableView *spellsPerDayTable;
	IBOutlet NSTextField *spellAbilityO;
	IBOutlet NSTextField *spellAbilityBonus;
	IBOutlet NSTextField *spellTotal;
	IBOutlet NSTextField *spellTotal2;
	IBOutlet NSTextField *spellsLeft;
	IBOutlet NSTextField *spellsCast;
	IBOutlet NSTextField *spellsBase;
	IBOutlet NSTextField *spellsMiscBonus;
	IBOutlet NSTextField *totalAvailableSpells;
	IBOutlet NSView *domainSpellOptionsView;
	IBOutlet NSView *totalSpellOptionsView;
	IBOutlet NSComboBox *domainCombo1;
	IBOutlet NSComboBox *domainCombo2;
	//overall views/tabviews.
	IBOutlet NSView *noSpellsView;
	IBOutlet NSView *spellsAvailableView;
	IBOutlet NSView *threeSpellClassesView;
	IBOutlet NSView *twoSpellClassesView;
	IBOutlet NSTabView *spellOptionsTabs;
	IBOutlet NSTabView *memorisedSpellsTabs;
	IBOutlet NSView *memorisedSpellsTotalView;
	IBOutlet NSTextField *memorisedSpellsClass;
	IBOutlet NSView *memorisedSpellView;
	IBOutlet NSTableView *memorisedSpellTable;
	IBOutlet NSTableView *spellsOfLevelTable;
	IBOutlet NSTableView *domainSpellsOfLevelTable;
	IBOutlet NSButton *removeFromMemorisedSpellsButton;
	IBOutlet NSButton *addToMemorisedSpellsButton;
	IBOutlet NSView *noView;
	//meta magic labels.
	IBOutlet NSButton *metaMagicFeats;
	IBOutlet NSWindow *metaMagicSheet;
	IBOutlet NSTableView *metaMagicTable;
	IBOutlet NSTextField *metaMagicWarning;
	IBOutlet NSButton *metaMagicContinueButton;
	//labels
	IBOutlet NSTextField *tooManySpells;
	IBOutlet NSTextField *tooFewSpells;
	//domain objects.
	IBOutlet NSBox *domainSpellsOfLevelBox;
	IBOutlet NSButton *addToDomainSpellsButton;
	IBOutlet NSButton *removeFromDomainSpellsButton;
	IBOutlet NSScrollView *domainSpellsOfLevelScroll;
	IBOutlet NSTextField *domainMemorisedTextField;
	//tables for spellbook
	IBOutlet NSTableView *availableSpellsTable;
	IBOutlet NSTableView *currentCharactersSpellsTable;
	IBOutlet NSButton *addToSpellbookButton;
	IBOutlet NSButton *removeFromSpellbookButton;
	//multiple class tab views
	IBOutlet NSTabView *twoSpellClassesTab;
	IBOutlet NSTabView *threeSpellClassesTab;
	//external functions.
	NSArrayController *charController;
	NSArrayController *spellController;
	NSTabView *characterTabView;
	BOOL magicViewChanging;
}
-(id)initWithCharController:(NSArrayController *)cCont
		withSpellController:(NSArrayController *)sCont
			withCharTabView:(NSTabView *)tabView;
-(NSManagedObjectContext *)managedObjectContext;
-(void)reloadSpellTables;
-(IBAction)setUpSpellsPerDay:(id)sender;
-(IBAction)spellToSpellbook:(id)sender;
-(IBAction)spellFromSpellbook:(id)sender;
-(IBAction)spellToMemorised:(id)sender;
-(IBAction)spellFromMemorised:(id)sender;
-(IBAction)spellToDomain:(id)sender;
-(IBAction)spellFromDomain:(id)sender;
-(void)spellFromDomain;
-(IBAction)metaMagicSheetEnded:(id)sender;
-(IBAction)domain1Setup:(id)sender;
-(IBAction)domain2Setup:(id)sender;
//view setup functions.
-(void)magicViewOpenedForChar:(NSManagedObject *)obj;
-(BOOL)classAMagicCaster:(NSString *)theClass;
-(BOOL)createSpellLevels:(NSString *)theClass
				 forChar:(NSManagedObject *)obj;
-(void)processMagicView:(NSTabViewItem *)magicView
			   forClass:(NSString *)theClass
				forChar:(NSManagedObject *)obj;
-(void)setUpMemorised:(NSTabView *)tabViewItem
			  forChar:(NSManagedObject *)obj
			 forClass:(NSString *)theClass;
-(void)tableViewSelectionDidChange:(NSNotification *)notification;
- (void)tabView:(NSTabView *)tabView
didSelectTabViewItem:(NSTabViewItem *)tabViewItem;
-(BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex;
//table data view methods.
-(int)numberOfRowsInTableView:(NSTableView *)aTableView;
-(id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
		   row:(int)row;
@end
